// 根据任务id查询对应的流程变量数据
function viewVariablesNode(id) {
    bootbox.confirm({
        title: "操作提示",
        size: "small",
        message: "你确定要查看选择的数据吗？",
        callback: function (result) {
            if (result) {
                var variables = null;
                $.ajax({
                    type: "GET",
                    cache: false,
                    url: "/admin/tasks/findProcessVariables/" + id,
                    contentType: "application/x-www-form-urlencoded;charset=utf-8",
                    dataType: "json",
                    success: function (result) {
                        if (result.errorCode == 'y') {
                            new $.zui.Messager('提示消息：' + result.errorText, {
                                icon: 'exclamation-sign',
                                type: 'success',
                                time: 2000
                            }).show();
                            // 一秒后跳转
                            setTimeout("location.reload()", 1000);
                        } else {
                            new $.zui.Messager('提示消息：' + result.errorText, {
                                icon: 'exclamation-sign',
                                type: 'danger',
                                time: 2000
                            }).show();
                        }
                    }, error: function (result) {
                        new $.zui.Messager('提示消息：' + result.errorText, {
                            icon: 'exclamation-sign',
                            type: 'danger',
                            time: 2000
                        }).show();
                    }
                });
            }
        }
    });
}
// 拾取任务
function takeTaskNode(id) {
    bootbox.confirm({
        title: "操作提示",
        size: "small",
        message: "你确定要查看选择的数据吗？",
        callback: function (result) {
            if (result) {
                var variables = null;
                $.ajax({
                    type: "GET",
                    cache: false,
                    url: "/admin/tasks/takeTask/" + id,
                    contentType: "application/x-www-form-urlencoded;charset=utf-8",
                    dataType: "json",
                    success: function (result) {
                        /*console.log("variables: " + result.variables);*/
                        // JSON.parse(jsonstr); //可以将json字符串转换成json对象
                        // JSON.stringify(jsonobj); //可以将json对象转换成json对符串
                        variables = JSON.stringify(result.variables);
                        /*console.log("variables: " + variables);*/
                        $("#processVariables").empty();
                        $("#processVariables").html(variables);
                        // 显示模态框
                        $('#processVariablesModal').modal({
                            keyboard : false,
                            show     : true
                        });
                    }, error: function (result) {
                        new $.zui.Messager('提示消息：' + result.errorText, {
                            icon: 'exclamation-sign',
                            type: 'danger',
                            time: 2000
                        }).show();
                    }
                });
            }
        }
    });
}